<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>基础数据-报表项目</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link href="../../../css/base/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="../../../css/base/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="../../../css/base/animate.min.css" rel="stylesheet">
    <link href="../../../css/plugins/table/bootstrap-table.css" rel="stylesheet"/>
    <link href="../../../css/plugins/alert/messager.css" rel="stylesheet"/>
    <link href="../../../css/plugins/date/bootstrap-datetimepicker.css" rel="stylesheet">
    <link href="../../../css/plugins/date/daterangepicker-bs3.css" rel="stylesheet">
    <link href="../../../css/plugins/clockpicker/bootstrap-clockpicker.min.css" rel="stylesheet"/>
    <link href="../../../css/plugins/select/bootstrap-multiselect.css" rel="stylesheet"/>
    <link href="../../../css/plugins/fileinput/fileinput.css" rel="stylesheet">
    <link href="../../../css/plugins/jquery/jquery.treegrid.css" rel="stylesheet"/>
    <link href="../../../css/plugins/icheck/orange.css" rel="stylesheet">
    <link href="../../../css/style-main.css" rel="stylesheet">
    <link href="../../../css/style.css" rel="stylesheet">
    <!--[if lt I]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <style type="text/css">
        .indexMask{
            width: 100%; height: 100%; position: fixed; left: 0px; top: 0px; z-index: 9999999; display: none; background: #7c7979;opacity: 0.8;
        }
        .indexMask2{
            position: absolute;top: 50%;left: 50%;margin: -50px 0px 0px -50px;width:100px;height: 100px;z-index: 99999;border-radius: 10px;
        }
    </style>
</head>

<body class="gray-bg" data-js="../../../js/module/base/meta_ProfitReportItem">

<div id="indexMask" class="indexMask">
    <div class="indexMask2" >
        <img src="../../../img/timg.gif" style="width: 100%;display: block;">
    </div>
</div>


<div class="row white-bg dashboard-header">
    <div class="col-sm-12">
    </div>
</div>

<div class="wrapper wrapper-content fadeInRight">
    <div id="main_div" class="row">
        <div class="col-sm-12">
            <div class="ibox-title">
                <h5>列表</h5>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div id="search-toolbar" class="search-toolbar">
                        <div class="form-inline" role="form">
                            <div class="form-group">
                                <input type="text" class="form-control" id="s_TemplateId" placeholder="请选择利润模版" readonly="readonly" />
                            </div>

                            <div class="form-group">
                                <button type="button" class="btn btn-search" id="btn_search"><i class="fa fa-search"> </i> 搜索</button>
<!--                                <button id="btn_add" class="btn btn-add"><i class="fa fa-plus"></i> 增加</button>-->
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <section class="panel">
                                <div id="tree_data_list">
                                    <!-- 绑定数据 -->
                                </div>
                            </section>
                        </div>
                    </div>

                    <!-- 模版语法 -->
                    <script type="text/template" id="tmpl_tree_data_list">
                        <div class="col-sm-12 text-right">
                            <button onclick="javascript:$('#org_tree').treegrid('expandAll');" class="btn btn-white btn-sm"><i
                                    class="fa fa-plus-square-o"></i> 全部展开
                            </button>
                            <button onclick="javascript:$('#org_tree').treegrid('collapseAll');" class="btn btn-white btn-sm"><i
                                    class="fa fa-minus-square-o"></i> 全部折叠
                            </button>
                            <!--                                                <button onclick="javascript:location.reload()" class="btn btn-white btn-sm"><i-->
                            <!--                                                        class="fa fa-refresh"></i> 刷新组织架构-->
                            <!--                                                </button>-->
                            <button onclick="BASE.ProfitprofitReportItem.addChild(0)" class="btn btn-add btn-sm"><i
                                    class="fa fa-plus"></i> 增加项目
                            </button>
                        </div>
                        <table class="table" id="org_tree">
                            <thead>
                            <tr>
                                <th width="20%">报表项目名称</th>
                                <th width="20%">类型</th>
                                <th width="20%">层级</th>
                                <th width="20%">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <!-- 数组迭代 -->
                            {{~it:value:index}}
                            <tr class="treegrid-{{= value.Id}}">
                                <td>{{= value.Name}}</td>
                                <td>
                                    {{if(value.Type==10){}}科目汇总{{}}}
                                    {{if(value.Type==20){}}公式{{}}}
                                    {{if(value.Type==30){}}标题{{}}}
                                </td>
                                <td>{{= value.Level}}</td>
                                <td>
                                    {{if(value.Id > 0){}}
                                    <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toEdit('{{= value.Id}}')"
                                       class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>
                                    <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.delete('{{= value.Id}}')"
                                       class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>
                                    <a href="javascript:void(0)"
                                       onclick="BASE.ProfitprofitReportItem.addChild('{{= value.Id}}', '{{= value.TemplateId}}', '{{= value.Level}}')"
                                       class="text-do-add"><i class="fa fa-plus"> 增加</i></a>

                                    <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toProfitReportItemDetail1('{{= value.Id}}')"
                                       class="text-do-view"><i class="fa fa-file-text-o"> 科目</i></a>
                                    <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toProfitReportItemDetail2('{{= value.Id}}')"
                                       class="text-do-view"><i class="fa fa-file-text-o"> 公式</i></a>
                                    {{}}}
                                </td>
                            </tr>
                                {{if(value.children && value.children.length>0) {}}
                                {{~value.children:val:num}}
                                <tr class="treegrid-{{= val.ParentId}}-{{= val.Id}} treegrid-parent-{{= val.ParentId}}">
                                    <td>{{= val.Name}}</td>
                                    <td>
                                        {{ if(val.Type==10){ }}科目汇总{{ } }}
                                        {{ if(val.Type==20){ }}公式{{ } }}
                                        {{ if(val.Type==30){ }}标题{{ } }}
                                    </td>
                                    <td>{{= val.Level}}</td>
                                    <td>
                                        {{if(value.Id > 0){}}
                                        <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toEdit('{{= val.Id}}')"
                                           class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>
                                        <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.delete('{{= val.Id}}')"
                                           class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>
<!--                                        <a href="javascript:void(0)"-->
<!--                                           onclick="BASE.ProfitprofitReportItem.addChild('{{= val.Id}}', '{{= val.TemplateId}}', '{{= val.Level}}')"-->
<!--                                           class="text-do-add"><i class="fa fa-plus"> 增加</i></a>-->


                                        <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toProfitReportItemDetail1('{{= val.Id}}')"
                                           class="text-do-view"><i class="fa fa-file-text-o"> 科目</i></a>
                                        <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toProfitReportItemDetail2('{{= val.Id}}')"
                                           class="text-do-view"><i class="fa fa-file-text-o"> 公式</i></a>
                                        {{}}}
                                    </td>
                                </tr>
<!--                                    {{if(val.children && val.children.length>0) {}}-->
<!--                                    {{~val.children:v:n}}-->
<!--                                    <tr class="treegrid-{{=v.ParentId}}-{{=v.Id}} treegrid-parent-{{=val.ParentId}}-{{= v.ParentId}}">-->
<!--                                        <td>{{= v.Name}}</td>-->
<!--                                        <td>-->
<!--                                            {{if(v.Type==10){}}科目汇总{{}}}-->
<!--                                            {{if(v.Type==20){}}公式{{}}}-->
<!--                                            {{if(v.Type==30){}}标题{{}}}-->
<!--                                        </td>-->
<!--                                        <td>{{= v.Level}}</td>-->
<!--                                        <td>-->
<!--                                            {{if(v.Id > 0){}}-->
<!--                                            <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toEdit('{{= v.Id}}')"-->
<!--                                               class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>-->
<!--                                            <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.delete('{{= v.Id}}')"-->
<!--                                               class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>-->
<!--                                            <a href="javascript:void(0)"-->
<!--                                               onclick="BASE.ProfitprofitReportItem.addChild('{{= v.Id}}', '{{= v.TemplateId}}', '{{= v.Level}}')"-->
<!--                                               class="text-do-add"><i class="fa fa-plus"> 增加</i></a>-->

<!--                                            <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toProfitReportItemDetail1('{{= v.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 科目</i></a>-->
<!--                                            <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toProfitReportItemDetail2('{{= v.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 公式</i></a>-->
<!--                                            {{}}}-->
<!--                                        </td>-->
<!--                                    </tr>-->
<!--                                        {{if(v.children && v.children.length>0) {}}-->
<!--                                        {{~v.children:vv:nn}}-->
<!--                                        <tr class="treegrid-{{=vv.ParentId}}-{{= vv.Id}} treegrid-parent-{{= v.ParentId}}-{{= vv.ParentId}}">-->
<!--                                            <td>{{= vv.Name}}</td>-->
<!--                                            <td>-->
<!--                                                {{if(vv.Type==10){}}科目汇总{{}}}-->
<!--                                                {{if(vv.Type==20){}}公式{{}}}-->
<!--                                                {{if(vv.Type==30){}}标题{{}}}-->
<!--                                            </td>-->
<!--                                            <td>{{= vv.Level}}</td>-->
<!--                                            <td>-->
<!--                                                {{if(vv.Id > 0){}}-->
<!--                                                <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toEdit('{{= vv.Id}}')"-->
<!--                                                   class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>-->
<!--                                                <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.delete('{{= vv.Id}}')"-->
<!--                                                   class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>-->

<!--                                                <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toProfitReportItemDetail1('{{= vv.Id}}')"-->
<!--                                                   class="text-do-add"><i class="fa fa-file-text-o"> 科目</i></a>-->
<!--                                                <a href="javascript:void(0)" onclick="BASE.ProfitprofitReportItem.toProfitReportItemDetail2('{{= vv.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 公式</i></a>-->
<!--                                                {{}}}-->
<!--                                            </td>-->
<!--                                        </tr>-->
<!--                                        {{~}}-->
<!--                                        {{}}}-->
<!--                                    {{~}}-->
<!--                                    {{}}}-->
                                {{~}}
                                {{}}}
                            {{~}}
                            </tbody>
                        </table>
                    </script>
                    <!-- page end-->
                </div>
            </div>
        </div>
    </div>

    <!-- 编辑信息 -->
    <div id="edit_div" class="row" style="display: none;">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑</h5>
                    <div class="ibox-tools">
                        <a class="back_list" href="javascript:void(0)">
                            <i class="fa fa-reply"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form id="fm" method="post" class="form-horizontal" role="form">
                        <input type="hidden" id="_id" name="_id"/>
                        <input type="hidden" id="ParentId" name="ParentId" />
                        <input type="hidden" id="TemplateId" name="TemplateId" />
                        <input type="hidden" id="Level" name="Level" />

                        <div class="modal-body">

                            <div class="form-group">
                                <label class="col-sm-2 control-label">报表项目名称</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" id="Name" name="Name" placeholder="请输入报表项目名称"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">报表显示名称</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" id="ShowName" name="ShowName" placeholder="请输入报表显示名称"/>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">报表项目计算类型</label>
                                <div class="col-sm-3">
                                    <div class="radio i-checks">
                                        <label style="margin-top: 10px;"><input type="radio" value="10" name="Type"><i></i> 科目汇总</label>
                                        <br />
                                        <label style="margin-top: 10px;"><input type="radio" value="20" name="Type" checked><i></i> 公式</label>
                                        <br />
                                        <label style="margin-top: 10px;"><input type="radio" value="30" name="Type" checked><i></i> 标题</label>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">科目汇总后值方向</label>
                                <div class="col-sm-3">
                                    <div class="radio i-checks">
                                        <label style="margin-top: 10px;"><input type="radio" value="-1" name="CalMethod"><i></i> -1</label>
                                        <br />
                                        <label style="margin-top: 10px;"><input type="radio" value="1" name="CalMethod" checked><i></i> 1</label>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">排序号</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" id="VisOrder" name="VisOrder" placeholder="请输入排序号"/>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <div id="btn-add-div" style="display: none">
                                    <button type="submit" class="btn btn-main">添加</button>
                                    <button class="btn btn-white back_list" type="reset">取消并返回</button>
                                </div>
                                <div id="btn-edit-div" style="display: none">
                                    <button type="submit" class="btn btn-main">修改</button>
                                    <button class="btn btn-white back_list" type="reset">取消并返回</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- 项目与科目相关 -->
    <div id="accountview_div" class="row" style="display: none">
        <div class="col-sm-12">
            <div class="ibox-title">
<!--                <h5>列表</h5>-->
                <div class="ibox-tools">
                    <a class="back_list" href="javascript:void(0)">
                        <i class="fa fa-reply"></i>
                    </a>
                </div>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div id="search-toolbar-accountview" class="search-toolbar">
                        <div class="form-inline" role="form">
                            <div class="form-group">
                                <button id="btn_add_accountview" class="btn btn-add"><i class="fa fa-plus"></i> 增加科目</button>
                            </div>
                        </div>
                    </div>
                    <table id="myTable1" data-click-to-select="true" data-show-add="true" data-show-refresh="true" data-show-toggle="true" data-show-columns="true">

                    </table>
                </div>
            </div>
        </div>
    </div>
    <!-- 项目公式相关 -->
    <div id="formula_div" class="row" style="display: none">
        <div class="col-sm-12">
            <div class="ibox-title">
<!--                <h5>列表</h5>-->
                <div class="ibox-tools">
                    <a class="back_list" href="javascript:void(0)">
                        <i class="fa fa-reply"></i>
                    </a>
                </div>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div id="search-toolbar-formula" class="search-toolbar">
                        <div class="form-inline" role="form">
                            <div class="form-group">
                                <button id="btn_add_formula" class="btn btn-add"><i class="fa fa-plus"></i> 增加公式</button>
                            </div>
                        </div>
                    </div>
                    <table id="myTable2" data-click-to-select="true" data-show-add="true" data-show-refresh="true" data-show-toggle="true" data-show-columns="true">

                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">编辑</h4>
            </div>
            <form id="fm_accountview" method="post" class="form-horizontal" role="form">
                <input type="hidden" id="ReportItemId" name="ReportItemId"/>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">科目</label>

                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="AccountViewCode" name="AccountViewCode" placeholder="请选择科目"/>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-main">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </form>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">编辑</h4>
            </div>
            <form id="fm_formula" method="post" class="form-horizontal" role="form">
                <input type="hidden" id="ReportItemId2" name="ReportItemId2"/>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">关联报表项目</label>

                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="FormulaReportItemId" name="FormulaReportItemId" placeholder="请选择科目"/>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label">运算关系</label>
                    <div class="col-sm-8">
                        <div class="radio i-checks">
                            <label><input type="radio" value="*1" name="FormulaCalMethod"><i></i> *1</label>
                            &nbsp;
                            <label><input type="radio" value="*-1" name="FormulaCalMethod"><i></i> *-1</label>
                            &nbsp;
                            <label><input type="radio" value="sum()" name="FormulaCalMethod" checked><i></i> sum()</label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-main">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="../../../js/base/require.min.js" defer="" data-main="../../../js/main"></script>

</body>

</html>